package timing.ukulele.log.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import timing.ukulele.log.mapper.SysLogMapper;
import timing.ukulele.log.persistent.SysLog;

@Service
//@Scope(proxyMode = ScopedProxyMode.TARGET_CLASS)
public class SysLogService extends ServiceImpl<SysLogMapper, SysLog> {
    public IPage<SysLog> getPage(SysLog log, int current, int pageSize) {
        Page<SysLog> page = new Page<>(current, pageSize);
        Page<SysLog> result = this.getBaseMapper().selectPage(page, new LambdaQueryWrapper<>(log).orderByDesc(SysLog::getId));
        return result;
    }
}
